import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface DeleteFavoriteMetricsBatchCancel_ {
  /**
   * @description ids
   */
  ids: number[];
}
export interface GetFavoriteMetricsList_ {
  /**
   * @description 指标类型。1：原子指标:，2：派生指标，3：衍生指标
   * @format int32
   */
  metricsType?: 1 | 2 | 3;
  /**
   * @description 页数
   * @format int32
   */
  pageNum?: number;
  /**
   * @description 条数
   * @format int32
   */
  pageSize?: number;
}
export interface GetFavoriteMetricsById_ {
  /**
   * @description 指标id
   */
  id: number;
}
export interface PutFavoriteMetricsById_ {
  /**
   * @description 指标id
   */
  id: number;
}

export class FavoriteMetrics {
  /**
   * 查询用户个人收藏的指标
   *
   * @tags 个人收藏controller
   * @request GET: /favorite-metrics
   * @secure
   */
  getFavoriteMetrics = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListFavoriteMetricsVO>({
      url: `/favorite-metrics`,
      method: "GET",
      ...params,
    });

  /**
   * 批量取消收藏指标
   *
   * @tags 个人收藏controller
   * @request DELETE: /favorite-metrics/batch-cancel
   * @secure
   */
  deleteFavoriteMetricsBatchCancel = (
    query: { ids: number[] } | DeleteFavoriteMetricsBatchCancel_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntity>({
      url: `/favorite-metrics/batch-cancel`,
      method: "DELETE",
      params: query,
      ...params,
    });

  /**
   * 批量收藏指标
   *
   * @tags 个人收藏controller
   * @request POST: /favorite-metrics/batch-create
   * @secure
   */
  postFavoriteMetricsBatchCreate = (batchIdsDto: defs.BatchIdsDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/favorite-metrics/batch-create`,
      method: "POST",
      data: batchIdsDto,
      ...params,
    });

  /**
   * 分页查询用户个人收藏的派生指标
   *
   * @tags 个人收藏controller
   * @request GET: /favorite-metrics/list
   * @secure
   */
  getFavoriteMetricsList = (
    query: { metricsType?: 1 | 2 | 3; pageNum?: number; pageSize?: number } | GetFavoriteMetricsList_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoFavoriteMetricsVO>({
      url: `/favorite-metrics/list`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 收藏单个指标
   *
   * @tags 个人收藏controller
   * @request GET: /favorite-metrics/{id}
   * @secure
   */
  getFavoriteMetricsById = ({ id }: { id: number } | GetFavoriteMetricsById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityBoolean>({
      url: `/favorite-metrics/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 取消收藏单个指标
   *
   * @tags 个人收藏controller
   * @request PUT: /favorite-metrics/{id}
   * @secure
   */
  putFavoriteMetricsById = ({ id }: { id: number } | PutFavoriteMetricsById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityBoolean>({
      url: `/favorite-metrics/${id}`,
      method: "PUT",
      ...params,
    });
}

export default new FavoriteMetrics();
